package org.github.manx98.jlibhac.tools.fssystem;

import lombok.extern.slf4j.Slf4j;
import org.github.manx98.jlibhac.fs.IStorage;
import org.github.manx98.jlibhac.fs.fsa.IFile;
import org.github.manx98.jlibhac.fs.fsa.OpenMode;

import java.io.IOException;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/4 2:13
 */
@Slf4j
public class StorageFile extends IFile {
    private final IStorage storage;
    public StorageFile(IStorage storage, OpenMode mode) {
        super(0);
        this.storage = storage;
    }

    @Override
    public void read(long offset, byte[] destination, int destOffset, int len) throws IOException {
        this.storage.read(offset, destination, destOffset, len);
    }

    @Override
    public long getSize() {
        return this.storage.getSize();
    }
}
